package aModelLayer;

import java.util.ArrayList;

public class Inventory {
	private static int size;
	private static ArrayList<Item> inventory = new ArrayList<Item>();
	
	public Inventory() {
		inventory = new ArrayList<Item>();
	}
		
	public int getSize() {
		return size;
	}
	
	public Item get(int i) {
		return inventory.get(i);
	}
	
	public static void addItem(Item item) {
		inventory.add(item);
	}
	
	public static void takeItem(Item item) {
		int index = inventory.indexOf(item);
		inventory.remove(index);
	}
	
	public static void useItem(Item item, BattleCharacter target) {
		if (item.getUsable() != 0)
			System.out.println("You can't use that!");
		else {
			target.setCurrentHealth(target.getCurrentHealth() + item.getCurrentHealth());
			target.setCurrentMana(target.getCurrentMana() + item.getCurrentMana());
			takeItem(item);
		}
	}
	
	public static void clearInventory() {
		if(inventory.size() > 0)
			inventory.clear();
	}
}
